
#line 1 "..\main.c" /0





 
 
  
#line 1 "..\..\..\..\..\..\..\..\..\Keil_v5\C51\INC\reg51.h" /0






 
 
 
 
 
 
 sfr P0   = 0x80;
 sfr P1   = 0x90;
 sfr P2   = 0xA0;
 sfr P3   = 0xB0;
 sfr PSW  = 0xD0;
 sfr ACC  = 0xE0;
 sfr B    = 0xF0;
 sfr SP   = 0x81;
 sfr DPL  = 0x82;
 sfr DPH  = 0x83;
 sfr PCON = 0x87;
 sfr TCON = 0x88;
 sfr TMOD = 0x89;
 sfr TL0  = 0x8A;
 sfr TL1  = 0x8B;
 sfr TH0  = 0x8C;
 sfr TH1  = 0x8D;
 sfr IE   = 0xA8;
 sfr IP   = 0xB8;
 sfr SCON = 0x98;
 sfr SBUF = 0x99;
 
 
 
 
 sbit CY   = 0xD7;
 sbit AC   = 0xD6;
 sbit F0   = 0xD5;
 sbit RS1  = 0xD4;
 sbit RS0  = 0xD3;
 sbit OV   = 0xD2;
 sbit P    = 0xD0;
 
 
 sbit TF1  = 0x8F;
 sbit TR1  = 0x8E;
 sbit TF0  = 0x8D;
 sbit TR0  = 0x8C;
 sbit IE1  = 0x8B;
 sbit IT1  = 0x8A;
 sbit IE0  = 0x89;
 sbit IT0  = 0x88;
 
 
 sbit EA   = 0xAF;
 sbit ES   = 0xAC;
 sbit ET1  = 0xAB;
 sbit EX1  = 0xAA;
 sbit ET0  = 0xA9;
 sbit EX0  = 0xA8;
 
 
 sbit PS   = 0xBC;
 sbit PT1  = 0xBB;
 sbit PX1  = 0xBA;
 sbit PT0  = 0xB9;
 sbit PX0  = 0xB8;
 
 
 sbit RD   = 0xB7;
 sbit WR   = 0xB6;
 sbit T1   = 0xB5;
 sbit T0   = 0xB4;
 sbit INT1 = 0xB3;
 sbit INT0 = 0xB2;
 sbit TXD  = 0xB1;
 sbit RXD  = 0xB0;
 
 
 sbit SM0  = 0x9F;
 sbit SM1  = 0x9E;
 sbit SM2  = 0x9D;
 sbit REN  = 0x9C;
 sbit TB8  = 0x9B;
 sbit RB8  = 0x9A;
 sbit TI   = 0x99;
 sbit RI   = 0x98;
 
 
#line 8 "..\main.c" /0
 
  
#line 1 "..\..\..\..\..\..\..\..\..\Keil_v5\C51\INC\stdio.h" /0






 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 typedef unsigned int size_t;
 
 
 #pragma SAVE
 #pragma REGPARMS
 extern char _getkey (void);
 extern char getchar (void);
 extern char ungetchar (char);
 extern char putchar (char);
 extern int printf   (const char *, ...);
 extern int sprintf  (char *, const char *, ...);
 extern int vprintf  (const char *, char *);
 extern int vsprintf (char *, const char *, char *);
 extern char *gets (char *, int n);
 extern int scanf (const char *, ...);
 extern int sscanf (char *, const char *, ...);
 extern int puts (const char *);
 
 #pragma RESTORE
 
 
 
#line 9 "..\main.c" /0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 typedef unsigned char BYTE;
 typedef unsigned int WORD;
 
 
 
 
 
 sfr T2H   = 0xd6;                
 sfr T2L   = 0xd7;                
 
 sfr P1M1 = 0x91;     
 sfr P1M0 = 0x92;     
 sfr P0M1 = 0x93;
 sfr P0M0 = 0x94;
 sfr P2M1 = 0x95;
 sfr P2M0 = 0x96;
 sfr P3M1 = 0xB1;
 sfr P3M0 = 0xB2;
 sfr P4M1 = 0xB3;
 sfr P4M0 = 0xB4;
 sfr P5M1 = 0xC9;
 sfr P5M0 = 0xCA;
 sfr P6M1 = 0xCB;
 sfr P6M0 = 0xCC;
 sfr P7M1 = 0xE1;
 sfr P7M0 = 0xE2;
 
 sfr  AUXR       =   0x8e;        
 
 sfr ADC_CONTR   =   0xBC;            
 sfr ADC_RES     =   0xBD;            
 sfr ADC_LOW2    =   0xBE;            
 sfr P1ASF       =   0x9D;            
 
 
 
 
 
 
 
 
 
 void InitUart();
 void SendData(BYTE dat);
 void Delay(WORD n);
 void InitADC();
 
 BYTE ch = 0;                         
 
 void main()
 {
 P0M0 = 0x00;    
 P0M1 = 0x00;
 P1M0 = 0x00;
 P1M1 = 0x00;
 P2M0 = 0x00;
 P2M1 = 0x00;
 P3M0 = 0x00;
 P3M1 = 0x00;
 P4M0 = 0x00;
 P4M1 = 0x00;
 P5M0 = 0x00;
 P5M1 = 0x00;
 P6M0 = 0x00;
 P6M1 = 0x00;
 P7M0 = 0x00;
 P7M1 = 0x00;
 
 InitUart();                      
 InitADC();                       
 IE = 0xa0;                       
 
 while (1)
 {
 ;
 }
 }
 


 













 


 
 void InitADC()
 {
 P1ASF = 0xff;                    
 ADC_RES = 0;                     
 ADC_CONTR = 0x80 | 0x00 | 0x08 | ch;
 Delay(2);                        
 }
 


 
 void InitUart()
 {
 SCON = 0x5a;                 
 
 T2L = (65536 - (11059200UL/4/115200));
 T2H = (65536 - (11059200UL/4/115200)) >> 8;
 AUXR = 0x14;                 
 AUXR |= 0x01;                
 
#line 151 "..\main.c" /1
 
 
 
 
 
 
 
 
 
 
 
#line 162 "..\main.c" /0
 }
 


 
 void SendData(BYTE dat)
 {
 
 TI = 0;                          
 SBUF = dat;                      
 }
 


 
 void Delay(WORD n)
 {
 WORD x;
 
 while (n--)
 {
 x = 5000;
 while (x--);
 }
 }
 
 
